package FourArithmeticOperations;

import java.util.ArrayList;

/**
 * Created by dell on 2017/9/26.
 */
public class Ayyaylist<T> implements BagInterface {
    Object[] list= new Object[10];
    @Override
    public int getCurrentSize() {
        return 0;
    }

    @Override
    public boolean isEmpty() {
        int num = 0;
        boolean result= false;
        for (int i = 0;i<list.length;i++){
            num ++;
            if (list[num]==null){
                result= true;
                break;
            }
        }
        return result;
    }

    @Override
    public boolean add(Object newEntry) {
        boolean result;
        int Index = 0;
        for (int i = 0;i<list.length;i++){
            if(list[i]!= null) {
                Index = i;
                result=true;
            }
            else result = false;
        }
        list[Index] = newEntry;
        return true;
    }

    @Override
    public Object remove() {
        return null;
    }

    @Override
    public boolean remove(Object anEntry) {
        int num = 0;
        boolean result= true;
        if (list!=null)
            for (int i = 0;i<list.length;i++){
                list[i] = anEntry;}
        else
        System.out.println("empty");
        return result;
    }

    @Override
    public void clear() {

    }

    @Override
    public int getFrequencyOf(Object anEntry) {
        return 0;
    }

    @Override
    public boolean contains(Object anEntry) {
        return false;
    }

    @Override
    public Object[] toArray() {
        return new Object[0];
    }
}
